local juxingfuchu = fk.CreateSkill{
    name = "ym2__juxingfuchu",
}
Fk:loadTranslationTable{
    ["ym2__juxingfuchu"] = "巨星复出",
    [":ym2__juxingfuchu"] = "结束阶段，你可以对自己造成1点雷电伤害。你每轮首次因属性伤害濒死时，回复所有体力、摸两张牌并将横置角色调整至三名。",
    ["#ym2__juxingfuchu"] = "是否发动 巨星复出，对自己造成1点雷电伤害",
    ["#ym2__juxingfuchu-choose"] = "巨星复出：选择要横置的三名角色，并重置其余角色",
}
juxingfuchu:addEffect(fk.EventPhaseStart,{
    anim_type = "offensive",
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(juxingfuchu.name) and player == target and player.phase == Player.Finish
    end,
    on_cost = function (self, event, target, player, data)
        if player.room:askToSkillInvoke(player,{
            skill_name = juxingfuchu.name,
            prompt = "#ym2__juxingfuchu"
        }) then
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        player.room:damage{
            from = player,
            to = player,
            skillName = juxingfuchu.name,
            damage = 1,
            damageType = fk.ThunderDamage,
        }
    end,
})
juxingfuchu:addEffect(fk.EnterDying,{
    anim_type = "support",
    can_trigger = function (self, event, target, player, data)
        if player == target and data.damage and data.damage.damageType and target.hp < 1 then
            if player:getMark("ym2__juxingfuchu-round") == 0 then
                player.room:setPlayerMark(player,"ym2__juxingfuchu-round",1)
                return not player.dead and player:hasSkill(juxingfuchu.name)
            end
        end
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:recover{
            num = player.maxHp - player.hp,
            skillName = juxingfuchu.name,
            who = player,
            recoverBy = player
        }
        player:drawCards(2,juxingfuchu.name)
        local tos = room:getAlivePlayers()
        if #tos > 3 then
            tos = room:askToChoosePlayers(player,{
                max_num = 3,
                min_num = 3,
                targets = room:getAlivePlayers(),
                skill_name = juxingfuchu.name,
                prompt = "#ym2__juxingfuchu-choose"
            })
        end
        for _, tp in ipairs(room.alive_players) do
            tp:setChainState(table.contains(tos,tp))
        end
    end,
})
return juxingfuchu